<template>
	<view>
		<view style="padding: 40rpx 40rpx 0rpx 40rpx;background-color: #FFFFFF;">
			<text style="font-weight: 500;font-size: 38rpx;">{{name}}</text>
			<view style="margin-left: -30rpx;display: flex;" @click="gomap">
				<!-- <u-icon name="map-fill" style="margin-left: 30rpx;" color="#55aaff"></u-icon> -->
				<u-cell-item style="width: 100%;" :title-style="titlestyle" :title="address"></u-cell-item>
			</view>
			<view style="margin-left: -30rpx;display: flex;" @click="telphone">
				<!-- <u-icon name="phone-fill" style="margin-left: 30rpx;" color="#ffaa00"></u-icon> -->
				<u-cell-item style="width: 100%;" :title-style="titlestyle" :title="tel" :border-bottom="false">
				</u-cell-item>
			</view>
			<!-- <view style="margin-left: -30rpx;display: flex;">
				<u-icon name="eye-fill" style="margin-left: 30rpx;" color="#ffaa00"></u-icon>
				<u-cell-item style="width: 100%;" :title-style="titlestyle" :title="'开放时间：'+opentime" :border-bottom="false"></u-cell-item>
			</view> -->
		</view>
		<view style="margin-top: 20rpx;padding: 40rpx;background-color: #FFFFFF;">
			<text style="font-weight: 500;font-size: 38rpx;">影院公告</text>
			<view style="margin-top: 30rpx;color: rgba(0,0,0,0.6);font-weight: bold;">
				<rich-text :nodes="yygg"></rich-text>
			</view>

		</view>
		<view style="margin-top: 20rpx;padding: 40rpx;background-color: #FFFFFF;">
			<text style="font-weight: 500;font-size: 38rpx;">影院描述</text>
			<view style="margin-top: 30rpx;color: rgba(0,0,0,0.6);font-weight: bold;">
				<rich-text :nodes="yyms"></rich-text>
			</view>

		</view>
	</view>
</template>

<script>
	import Config from '../../common/config.js';
	export default {
		data() {
			return {
				id: "1",
				opentime: "",
				address: "",
				tel: "",
				name: "",
				location: "",
				key: '53d50c1fc3cd62c55cb38017557d39c9',
				titlestyle: {
					'font-weight': 'bold',
					'font-size': '32rpx',
					'color': 'rgba(0, 0, 0, 0.5)',

				},
				yygg: '',
				yyms: ''
			}
		},
		onLoad(param) {
			// this.name = param.name;
			// this.location = param.location;
			this.id = param.id;
			this.getRegeo()
		},
		methods: {
			telphone() {
				uni.makePhoneCall({
					phoneNumber: this.tel //仅为示例
				});
			},
			gomap() {
				let coordS = this.location;
				let that = this;
				let tmpc = coordS.split(',')
				that.longitude = tmpc[0]
				that.latitude = tmpc[1]
				uni.openLocation({
					latitude: parseFloat(that.latitude),
					longitude: parseFloat(that.longitude),
					name: that.name,
					address: that.address,
					scale: 18,
					fail: function(res) {

					}
				})
			},
			getRegeo() {
				let that = this;

				uni.request({
					url: Config.ServerIP + "/movie/app/movie/cinemaInfo/" + that.id,
					success: (res) => {

						if (res.data.code != 200) {
							return
						}
						that.tel = res.data.data.tel;
						that.address = res.data.data.address
						that.name = res.data.data.name
						that.location = res.data.data.coord
						let tmpyygg = res.data.data.specialDescription
						var reg = new RegExp("[\\u4E00-\\u9FFF]+", "g");
						if (reg.test(tmpyygg)) {
							that.yygg = res.data.data.specialDescription.replace(/\[A%#\]/g, "<br>")
						} else {
							that.yygg = "暂无公告"

						}
						let tmpyyms =  res.data.data.description.replace(/\[A%#\]/g, "<br>")
						if(tmpyyms !=""){
							if (reg.test(tmpyygg)) {
								that.yyms = tmpyyms
							} else {
								that.yyms = "暂无描述"
							
							}
						}else{
							that.yyms = "暂无描述"
						}
						
					}
				})
			}
		}
	}
</script>

<style>
	page {
		background-color: #f4f4f4;
	}
</style>
